

import { Component } from 'react';

// 操作props
const withInputControl = (WrapperComponent:any) => {
  return class extends  Component {

    state = {
      value: ''
    }

    handleInputChangeVlaue = (e:any) => {
      this.setState({
        value: e.target.value
      }, () => {
        console.log(this.state, 'state')
      })
    }

    // value / onChange
    render() {
      return <WrapperComponent
        {...this.state}
        onChange={this.handleInputChangeVlaue}

      {...this.props} />
    }
  }
}

export default withInputControl;
